#pragma once
#include<string>
class Character;
class Monster;

class Effect {
public:
	virtual ~Effect() = default;
	virtual std::string getName() const = 0;
	virtual float getProbability() const = 0;
	virtual bool apply(Character& target) const = 0;
	virtual bool apply(Monster& target) const = 0;
};

#pragma region"晕眩"
class StunEffect : public Effect {
public:
	explicit StunEffect(float prob = 0.25f, int dur = 1);
	std::string getName() const override;
	float getProbability() const override;
	bool apply(Character& target) const override;
	bool apply(Monster& target) const override;
private:
	float probability;
	int duration;
	bool checkSuccess() const;
};
#pragma endregion

#pragma region"增加攻击力"
class AttackBoostEffect : public Effect {
public:
	explicit AttackBoostEffect(float prob = 0.5f, int increase = 1);
	std::string getName() const override;
	float getProbability() const override;
	bool apply(Character& target) const override;
	bool apply(Monster& target) const override;
private:
	float probability;
	int attackIncrease;
	bool checkSuccess() const;
};
#pragma endregion

#pragma region"增加防御力"
class DefenseBoostEffect : public Effect {
public:
	explicit DefenseBoostEffect(float prob = 0.6f, int increase = 1);
	std::string getName() const override;
	float getProbability() const override;
	bool apply(Character& target) const override;
	bool apply(Monster& target) const override;
private:
	float probability;
	int defenseIncrease;
	bool checkSuccess() const;
};
#pragma endregion

#pragma region"恢复生命值"
class HealEffect : public Effect {
public:
	explicit HealEffect(float prob = 0.4f, int amount = 5);
	std::string getName() const override;
	float getProbability() const override;
	bool apply(Character& target) const override;
	bool apply(Monster& target) const override;
private:
	float probability;
	int healAmount;
	bool checkSuccess() const;
};
#pragma endregion
